<template>
{{#if page.psSysPFPlugin}}
    {{> @macro/plugins/view/view-use.hbs appPlugin=page.psSysPFPlugin}}
{{else}}
    {{#if page.psViewLayoutPanel.useDefaultLayout}}
    <AppMDViewLayout :class="classNames" :openType="openType">
        <template #viewHeaderContentLeft {{#unless (and page.enableQuickGroup page.quickGroupPSCodeList)}}v-if="model.showCaption && !noViewCaption" {{/unless}}>
      		<div {{#and page.enableQuickGroup page.quickGroupPSCodeList}}v-if="model.showCaption && !noViewCaption" {{/and}}class="view-header__caption">
                {{> @macro/view/view-caption.hbs}}
            </div>
        {{#and page.enableQuickGroup page.quickGroupPSCodeList}}
            <div class="view-header__quickgroup">
                {{> @macro/common/quick-group.hbs}}
            </div>
        {{/and}}
    	</template>
        {{#or page.enableQuickSearch (hasCtrl page.ctrls 'TOOLBAR')}}
    	<template #viewHeaderContentRight  {{#and (hasCtrl page.ctrls 'TOOLBAR') (eq page.enableQuickSearch false)}}v-if="store.toolbarItems.length >0"{{/and}}>
            {{#or (hasCtrl page.ctrls 'QUICKSEARCHBAR') page.enableQuickSearch}}
            <div class="view-header__quicksearch" v-show="!store.expandSearchForm">
                {{> @macro/common/quick-search.hbs placeholder="model.quickSearchPlaceholder"}}
            </div>
            {{/or}}
            {{#each page.ctrls as | ctrl |}}
            {{#eq ctrl.controlType 'TOOLBAR'}}
            <div class="view-headert__toolbar">
                {{> @macro/widgets/toolbar/toolbar.hbs page=page ctrl=ctrl}}
            </div>
            {{/eq}}
            {{/each}}
    	</template>
        {{/or}}
        {{#hasCtrl page.ctrls 'SEARCHFORM'}}
		<template v-slot:[searchFormSlotName]>
		{{#each page.ctrls as | ctrl |}}
			{{#and (eq ctrl.controlType 'SEARCHFORM') (neq ctrl.formStyle 'SEARCHBAR')}}
			{{> @macro/widgets/form-detail/search-form.hbs ctrl=ctrl}}
			{{/and}}
		{{/each}}
		</template>
		{{/hasCtrl}}
        <template #default>
            {{#each page.ctrls as | ctrl |}}
            {{#eq ctrl.controlType 'DATAVIEW'}}
            {{> @macro/widgets/dataview/dataview.hbs ctrl=ctrl props=":rowActiveMode='model.rowActiveMode'"}}
            {{/eq}}
            {{/each}}
        </template>
        {{> @macro/view/view-msg.hbs}}  
  	</AppMDViewLayout>
    {{else}}
    <div :class="classNames">
        {{#if page.psViewLayoutPanel.rootPSPanelItems}}
        {{#each page.psViewLayoutPanel.rootPSPanelItems as | panelItem |}}
        {{> @macro/widgets/panel-detail/include-panel.hbs type=panelItem.itemType item=panelItem isMultiData=false panel=page.psViewLayoutPanel page=page}}
        {{/each}}
        {{/if}}
    </div>
    {{/if}}
{{/if}}
</template>
<script setup lang="ts">
// 基于template/src/views/\{{appModules}}/\{{pages@DEDATAVIEW}}/\{{spinalCase page.codeName}}.vue.hbs生成
{{#if page.psViewLayoutPanel.useDefaultLayout}}
import { AppMDViewLayout } from '@components/layout/md-view-layout';
{{> @macro/widgets/ctrl/import-ctrl.hbs ctrls=page.ctrls}}
{{else}}
import { AppCtrlPos, AppScrollContainer, AppSimpleFlexContainer, AppStandardContainer, AppTabPanel, AppTabPage } from '@components/layout-element/structure';
{{#if page.psViewLayoutPanel.viewProxyMode}}
{{> @macro/widgets/ctrl/import-ctrl.hbs ctrls=page.psViewLayoutPanel.psControls}}
{{else}}
{{> @macro/widgets/ctrl/import-ctrl.hbs ctrls=page.ctrls}}
{{/if}}
{{/if}}
import {
    useNavParamsBind,
    useEventBind,
    getViewClassNames,
{{#and page.enableQuickGroup page.quickGroupPSCodeList}}
    handleQuickGroupValueChange,
{{/and}}
{{#if page.enableQuickSearch}}
    handleQuickSearch,
{{/if}}
{{#page.ctrls}}
  {{#eq controlType 'TOOLBAR'}}
    handleToolbarItemClick,
  {{/eq}}
{{/page.ctrls}}
    handleCtrlAction, 
    handleCtrlInit, 
    handleCtrlDestroy, 
{{#unless page.psViewLayoutPanel.useDefaultLayout}}
    handleComponentAction,
{{/unless}}
} from "@/hooks/use-view";
import { DataViewActionType, DataViewController, IDataViewAbility, IDataViewControllerParams, IDataViewStore, IDataViewCtrlController, IParam, IContext, ILoadingHelper, LoadingHelper, IDataViewController, IEvent, IProjectSetting } from "@/core";
import { model{{#page.ctrls}}{{#eq controlType 'TOOLBAR'}}, toolbarItems{{/eq}}{{/page.ctrls}} } from "./{{spinalCase page.codeName}}-model";
{{> @macro/view/view-props.hbs}}

{{> @macro/common/emit.hbs name="view" actionType="DataViewActionType" ability="IDataViewAbility"}}

//  样式名称
const classNames = computed(() => {
  	return getViewClassNames(model, props);
});
const projectSetting: IProjectSetting = App.getProjectSetting();

const showTabPageExp = projectSetting.multiTabsSetting.show;

const searchFormSlotName = computed(() => {
    let searchFormSlotName = 'viewHeaderTop';
    if (!showTabPageExp && props.openType == 'ROUTE') {
        searchFormSlotName = 'viewHeaderBottom';
    }
  	return searchFormSlotName;
});
const params: IDataViewControllerParams<DataViewActionType, IDataViewAbility> = {
    name: props.name,
  	model,
  	evt,
    isLoadDefault: props.isLoadDefault,      
  	openType: props.openType,
  	pLoadingHelper: props.pLoadingHelper,
  	handler: (data: IDataViewStore) => { return reactive(data); }
}

{{> @macro/common/controller.hbs name="view" IController="IDataViewController" store="IDataViewStore" ability="IDataViewAbility" controller="DataViewController"}}
</script>